package com.bruan.recursion;

import java.io.UnsupportedEncodingException;
import java.util.Arrays;

public class ByteTest {
    public static void main(String[] args) throws UnsupportedEncodingException {
        //编码
        String s = "我是你爹hhh";
        byte[] bytes = s.getBytes();
        System.out.println(Arrays.toString(bytes));
        byte[] bytes1 = s.getBytes("GBK");
        System.out.println(Arrays.toString(bytes1));
        //解码
        String s1 = new String(bytes);
        System.out.println(s1);
        String s2 = new String(bytes1);
        System.out.println(s2);
    }
}
